<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    *{
            margin: 0;
            padding: 0;
        }
    .box{
        position: absolute;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background-color: #000;
    }
    </style>
</head>
<body>
    <div class="box"> </div>
    <script>
    var box = document.querySelector('.box')
    var dis = 0,timer =0;
    
    timer = setInterval(function () {
        box.style.left = ++dis + 'px'
        if (dis>=500)
        clearInterval(timer)
    },16)
    
    </script>
</body>
</html>